package org.sunsys.qa.web.command;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.sunsys.qa.service.response.Response;
import org.sunsys.qa.service.user.UserValidationService;
import org.sunsys.qa.user.User;


public class UserLoginCommand implements QaWebCommand {

	public UserLoginCommand() {
	}
	
	@Override
	public Response execute(HttpServletRequest request, HttpServletResponse response) {
		String userId = request.getParameter("userId");
		String password = request.getParameter("password");

		User user = new User();
		user.setPassword(password);
		user.setUserId(userId);
		
		UserValidationService validationService = new UserValidationService();

		/* validate user id and credentials and return response */
		return validationService.service(user);
	}
	
}
